﻿@model IEnumerable<WarOfDev.EF.Post>
@using WarOfDev.Core.Common
@{
    ViewBag.Title = "Index";
}

<h2>All Puzzles</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<div  class="container_12 grid_6 alpha">
<table >
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Title)
        </th>
       
        <th>
            @Html.DisplayNameFor(model => model.Tags)
        </th>

        <th>
            @Html.DisplayNameFor(model => model.CreatedBy)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreatedOn)
        </th>
     
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>

        <td>
            @Html.DisplayFor(modelItem => item.Tags)
        </td>
     
        <td>
            @Html.DisplayFor(modelItem => item.Developer.NickName)
        </td>
        <td>
            @item.CreatedOn.Value.ToString("yyyy-MM-dd hh:mm:ss")
        </td>

        <td>
            @if (ViewData["currentDeveloperId"].ToString() == item.CreatedBy && item.Status<(int)EnumPostStatus.Rewarding)
            {
                @Html.ActionLink("Edit", "Edit", new { id=item.Id }) 
            }
            
            @Html.ActionLink("Details", "Details", new { id=item.Id }) 
        </td>
    </tr>
}

</table>
</div>
<div  class="container_12 grid_3 omega">
    <div id="tagCloud">
    </div>
</div>

<div class="clear"></div>
@Scripts.Render("~/Scripts/jqcloud-1.0.1.min.js")
<script type="text/javascript">
    $.ajax({
        url: "@(Url.Action("Tags","Cate", new {postType = WarOfDev.Core.Common.EnumPostType.Puzzle}))",
        type: "post",
        success: function (e) {
            $("#tagCloud").jQCloud(e,{width:260,height:200});
        }
    });
</script>